@extends('layouts.admin_common') @section('content')
    @if(app('env')=='production')
        <script src="{{ secure_asset('/js/sy_common.js') }}"></script>
    @else
        <script src="{{ asset('/js/sy_common.js') }}"></script>
    @endif

    <div class="breadcrumbs_container">{{
	Breadcrumbs::render('admin.shop_seil_list') }}</div>


    <style>
        .lyx_001{
            width: 10rem;
        }
        .lyx_002{
            width: 11rem;
        }
        .lyx_003{
            width: 12rem;
        }
    </style>

    <div class="system_tab_line"></div>

    <div class="lyx_search_table">
        <form>

            <div class="row">

                <div class="form-group row col-sm-3">
                    <label for="inputPassword" class="col-sm-4 col-form-label">売上日</label>
                    <div class="col-sm-8">
                        <input class="form-control lyx_datetimepicker" type="text" @isset($param['star_date']) value="{{$param['star_date']}}"  @endisset name="star_date">
                    </div>
                </div>

                <div class="form-group row col-sm-3">
                    <label for="inputPassword" class="col-sm-1 col-form-label">~</label>
                    <div class="col-sm-8">
                        <input class="form-control lyx_datetimepicker" type="text" @isset($param['end_date']) value="{{$param['end_date']}}" @endisset name="end_date">
                    </div>
                </div>

                <div class="form-check form-check-inline col-sm-2">
                    <button class="btn btn-primary button_normal">检索</button>
                </div>

                {{--<div class="form-check form-check-inline col-sm-2">--}}
                    {{--<button class="btn btn-primary button_normal">csv出力</button>--}}
                {{--</div>--}}

            </div>


        </form>


        <div class="lyx_table">
            <div class="row lyx_table_title">
                <div class="col-sm-1"></div>
                <div class="col-sm-7">未入金一覧</div>
                <div class="col-sm-4">出力日:2018 / 8/31</div>
            </div>
            <div class="row">
                <div class="col-sm-1"></div>
                <div class="col-sm-6">
                    請求日:2018 / 4/1 〜 2018/8/31
                </div>
            </div>
            @foreach($list as $value)
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th scope="col" rowspan="5"></th>
                        <th scope="col">会社名</th>
                        <th scope="col">会社合計</th>
                        <th scope="col">店舗名</th>
                        <th scope="col">店舗合計</th>
                    </tr>
                    </thead>
                    <tbody class="lyx_tbody">
                    <?php $all_money = 0; ?>
                    @foreach($value as $two)
                        <?php $all_money = $all_money + $two->total_money;?>
                        <tr>
                            @if ($loop->first)
                                <td rowspan="{{$loop->count+1}}" class="lyx_001">ランキング{{$loop->parent->iteration}}位</td>
                                <td rowspan="{{$loop->count}}" class="lyx_002">{{fun_corp($two->corp_id)}}</td>
                                <td rowspan="{{$loop->count}}" class="view_all_money lyx_003"></td>
                            @endif
                            <td>{{fun_shop($two->shop_id)}}</td>
                            <td>¥{{$two->total_money}}</td>
                        </tr>

                    @endforeach
                    <tr class="lyx_all_total_money" style="display: none" data-all_money="{{$all_money}}"></tr>
                    </tbody>
                </table>
            @endforeach
        </div>

    </div>
<script>
    $('.lyx_tbody').each(function (index,item) {
       var total_money = $(this).find('.lyx_all_total_money').data('all_money');
       $(this).find('.view_all_money').html('¥'+total_money);
    })
</script>

@endsection

